package top.wettis.chat.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import top.wettis.chat.mapper.QuestiionMapper;
import top.wettis.chat.pojo.DO.Questiion;
import top.wettis.chat.service.IQuestiionService;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wettis
 * @since 2023-03-28
 */
@Service
public class QuestiionServiceImpl extends ServiceImpl<QuestiionMapper, Questiion> implements IQuestiionService {

    @Override
    public String get(String word, String q) {
        Questiion questiion = getBaseMapper().selectOne(new LambdaQueryWrapper<Questiion>()
                .eq(Questiion::getTag, word)
                .eq(Questiion::getQuestion, q));
        return questiion.getAnswer();
    }
}
